﻿using System;
using Microsoft.Xna.Framework;

namespace Terraria.World.Generation
{
	// Token: 0x0200008B RID: 139
	public abstract class GenAction : GenBase
	{
		// Token: 0x06000A13 RID: 2579
		public abstract bool Apply(Point origin, int x, int y, params object[] args);

		// Token: 0x06000A14 RID: 2580 RVA: 0x0000AE5D File Offset: 0x0000905D
		protected bool UnitApply(Point origin, int x, int y, params object[] args)
		{
			if (this.OutputData != null)
			{
				this.OutputData.Add(x - origin.X, y - origin.Y);
			}
			return this.NextAction == null || this.NextAction.Apply(origin, x, y, args);
		}

		// Token: 0x06000A15 RID: 2581 RVA: 0x0000AE9C File Offset: 0x0000909C
		public GenAction IgnoreFailures()
		{
			this._returnFalseOnFailure = false;
			return this;
		}

		// Token: 0x06000A16 RID: 2582 RVA: 0x0000AEA6 File Offset: 0x000090A6
		protected bool Fail()
		{
			return !this._returnFalseOnFailure;
		}

		// Token: 0x06000A17 RID: 2583 RVA: 0x0000AEB1 File Offset: 0x000090B1
		public GenAction Output(ShapeData data)
		{
			this.OutputData = data;
			return this;
		}

		// Token: 0x04000EA4 RID: 3748
		public GenAction NextAction;

		// Token: 0x04000EA5 RID: 3749
		public ShapeData OutputData;

		// Token: 0x04000EA6 RID: 3750
		private bool _returnFalseOnFailure = true;
	}
}
